<?php
$allowedFileType = array('image/gif','image/jpeg','image/png','application/pdf','application/msword','application/vnd.ms-excel','text/plain'); 
$uploadPath = './upload';
$limitSize = 1024000;
$inputname = 'fileAttach';

$name = $HTTP_POST_FILES['fileAttach']['name'];
$extPos = strrpos($name,'.');
if($extPos > 0)$ext = substr($name,$extPos);
$fileName = mktime().$ext;

if($_GET['action']=='upload')
	uploadFile($inputname,$limitSize,$allowedFileType,$uploadPath.'/'.$fileName,$HTTP_POST_FILES); 
if($_GET['action']=='delete')
	unloadFile($fileid);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<form action="upload.php" method="post" enctype="multipart/form-data" name="attachment"> 
<input type="file" name="fileAttach" onChange="document.attachment.submit()"> 
</form> 
</body>
</html>